package factorys;

import entity.Person;

import java.io.IOException;
import java.util.Properties;

/**
 * @author Rain
 * @date 2022/08/17 15:47
 */
public class PersonFactory {
    public static Person makePerson(){
        Properties properties = new Properties();

        Person p = null;
        try {
            properties.load(PersonFactory.class.getResourceAsStream("../person.properties"));
            String str = properties.getProperty("person");
            p = (Person)Class.forName(str).newInstance();
        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | IOException e) {
            e.printStackTrace();
        }

        return p;
    }
}
